﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Com.Library.DB.PageAuth
{
	public class PageAuthModel
	{
		public static List<PageAuthMainEntity> PageAuthMainList(int ManagerSN)
		{
			PageAuthMainGetListArguments arg = new PageAuthMainGetListArguments();
			arg.n4ManagerSN = ManagerSN;

			PageAuthMainGetList sp = new PageAuthMainGetList();
			sp.SetArguments(arg);
			List<PageAuthMainEntity> list = sp.Execute();

			return list;
		}

		public static void SetAuthMain(int ManagerSN, int MainPageType, byte CodeAuthType, string ManagerName)
		{
			PageAuthMainSetArguments arg = new PageAuthMainSetArguments();
			arg.n4ManagerSN = ManagerSN;
			arg.n4MainPageType = MainPageType;
			arg.CodeAuthType = CodeAuthType;
			arg.strManagerName = ManagerName;

			PageAuthMainSet sp = new PageAuthMainSet();
			sp.SetArguments(arg);
			sp.ExecuteNonQuery();
		}

		public static List<PageAuthSubEntity> PageAuthSubList(int ManagerSN, int MainPageType)
		{
			PageAuthSubGetListArguments arg = new PageAuthSubGetListArguments();
			arg.n4ManagerSN = ManagerSN;
			arg.n4MainPageType = MainPageType;

			PageAuthSubGetList sp = new PageAuthSubGetList();
			sp.SetArguments(arg);
			List<PageAuthSubEntity> list = sp.Execute();

			return list;
		}

		public static void SetAuthSub(int ManagerSN, int MainPageType, int SubPageType, byte CodeAuthType, string ManagerName)
		{
			PageAuthSubSetArguments arg = new PageAuthSubSetArguments();
			arg.n4ManagerSN = ManagerSN;
			arg.n4MainPageType = MainPageType;
			arg.n4SubPageType = SubPageType;
			arg.CodeAuthType = CodeAuthType;
			arg.strManagerName = ManagerName;

			PageAuthSubSet sp = new PageAuthSubSet();
			sp.SetArguments(arg);
			sp.ExecuteNonQuery();
		}

		public static List<PageSubTypeEntity> SubPageList(int MainPageType)
		{
			PageSubTypeGetListArguments arg = new PageSubTypeGetListArguments();
			arg.n4MainPageType = MainPageType;

			PageSubTypeGetList sp = new PageSubTypeGetList();
			sp.SetArguments(arg);
			List<PageSubTypeEntity> list = sp.Execute();

			return list;
		}

		public static List<PageMainTypeEntity> MainPageList()
		{
			PageMainTypeGetList sp = new PageMainTypeGetList();
			List<PageMainTypeEntity> list = sp.Execute();

			return list;
		}
	}
}
